//package com.example.ControllerDemo;
//
//import cn.hutool.jwt.JWT;
//import com.example.Objects.SignInReq;
//import jakarta.annotation.Resource;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import java.nio.charset.StandardCharsets;
//
//@RestController
//@RequestMapping("/user")
//public class AuthController {
//
////    @Resource
////    AuthenticationManager authenticationManager;
////
////
////    @PostMapping("/login")
////    public String login(@RequestBody SignInReq req) {
////
////        UsernamePasswordAuthenticationToken authenticationToken =
////                new UsernamePasswordAuthenticationToken(req.getUsername(), req.getPassword());
////        authenticationManager.authenticate(authenticationToken);
////
////        //上一步没有抛出异常说明认证成功，我们向用户颁发jwt令牌
////        String token = JWT.create()
////                .setPayload("username", req.getUsername())
////                .setKey(MyConstant.JWT_SIGN_KEY.getBytes(StandardCharsets.UTF_8))
////                .sign();
////
////        return token;
////    }
//}